from distutils.core import setup
import py2exe
import sys
import os.path
import shutil

def delete(list):
    for dir in list:
        if os.path.isdir(dir):
            shutil.rmtree(dir)

# Set path
sys.path.append("./src")

py2exe_options = {
"compressed": 1,
"optimize": 2,
"bundle_files": 2}

setup(
	version = "0.1",
	description = "Mayapad",
	name = "Mayapad",
	console = [
		{"script": "src/Mayapad.py",
		 "icon_resources": [(1, "rsc/Mayapad.ico")],
		 "dest_base": "MayapadConsole"},
	],
	windows = [
		{"script": "src/Mayapad.pyw",
		 "icon_resources": [(1, "rsc/Mayapad.ico")],
		 "dest_base": "Mayapad"},
	],
) 
# Clean-up
delete(['bin'])

# Copy
shutil.move('dist', 'bin')
shutil.copyfile('rsc/mel.png', 'bin/mel.png')
shutil.copyfile('rsc/py.png', 'bin/py.png')
shutil.copyfile('rsc/RunAll.png', 'bin/RunAll.png')
shutil.copyfile('rsc/RunSelection.png', 'bin/RunSelection.png')
shutil.copyfile('rsc/scriptDir.png', 'bin/scriptDir.png')
shutil.copyfile('rsc/scriptDir_open.png', 'bin/scriptDir_open.png')

# Clean-up
delete(['build'])
